<?php
class LoginControl extends Control {
	public function login(){
		$this->view->display('login.html');
	}
	public function loginck(){
		if($_POST['login']=='登 陆'){
				$username=$_POST['name'];
				$password=md5($_POST['pwd']);
				$admin=new AdminModel();
				$userinfo=$admin->login($username);
				if($userinfo&&$password==$userinfo['pwd']){
					$_SESSION['identity']=$_SERVER['HTTP_HOST'];
					$_SESSION['uid']=$userinfo['id'];
					$_SESSION['name']=$userinfo['name'];
					$_SESSION['relname']=$userinfo['relname'];
					$this->success('/index.php/Admin/Index/index','登录成功');
				}else{
					$this->error('/index.php/Admin/Login/login','密码或用户名错误');
				}

		}else{
			$this->error('/index.php/Admin/Login/login','非法登录');
		}
	}
	public function loginout(){
		session_destroy();
		$this->jump('/index.php/Admin/Login/login');
	}
	
}
?>